package com.zjzywl.smoke.controller;

import com.zjzywl.smoke.entity.Device;
import com.zjzywl.smoke.entity.dto.GpsDeviceDto;
import com.zjzywl.smoke.util.WebResult;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.ServletRequestDataBinder;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestClientException;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.websocket.server.PathParam;
import java.io.File;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;

@RestController
@RequestMapping(value = "/chatRecord")
public class ChatRecordController extends BaseController {

    @RequestMapping("/findByUserIdAndFriendId")
    public WebResult findByUserIdAndFriendId(@RequestParam("userid") String userid, @RequestParam("friendid") String friendid,@RequestParam("alarmid") String alarmid) {
        try {
            ResponseEntity<Object> byUserIdAndFriendId = appConfig.restTemplate().getForEntity(appConfig.getGetDataIp()
                            + "/chatRecord/findByUserIdAndFriendId?userid="+userid+"&friendid="+friendid+"&alarmid="+alarmid,
                    Object.class);
            return WebResult.OK(byUserIdAndFriendId);
        } catch (Exception e) {
            e.printStackTrace();
            return WebResult.FAIL(e.toString());
        }
    }

}
